package com.zhuzg.common.domain;

import lombok.Data;
import org.springframework.boot.jdbc.DataSourceBuilder;

import javax.sql.DataSource;

@Data
public class TenantDataSource {
    private String tenantId;

    private String url;


    private String username;


    private String password;

    /**
     * 根据数据库的表内容构建数据源
     * @return
     */
    public DataSource createDataSource() {
        return DataSourceBuilder.create()
                .url(this.url)
                .username(this.username)
                .password(this.password)
                .build();
    }
}
